package com.cxrj.zhsq.partyMember.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cxrj.zhsq.annotation.SystemControllerLog;
import com.cxrj.zhsq.partyMember.entity.PartyMember;
import com.cxrj.zhsq.partyMember.service.PartyMemberService;

@Controller
@RequestMapping("/PartyMember")
public class PartyMemberController {
	
	@Resource
	private PartyMemberService partyMemberService;
	
	/**
	 * 插入或修改
	 * @param partyMember
	 * @return
	 */
	@RequestMapping("insertAndUpdatePartyMember")
	@SystemControllerLog(description = "添加党员数据")
	@ResponseBody
	public Map<String, Object> insertAndUpdatePartyMember(PartyMember partyMember){
		return partyMemberService.insertAndUpdatePartyMember(partyMember);
	}
	
	/**
	 * 分页查询党员
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "selectPartyMemberPage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public Map<String, Object> selectPartyMemberPage(HttpServletRequest request,HttpServletResponse response){
		return partyMemberService.selectPartyMemberPage(request,response);
	}
	
	/**
	 * 根据Id查询
	 * @param partyMemberId
	 * @return
	 */
	@RequestMapping("selectById")
	@ResponseBody
	public Map<String, Object> selectById(String partyMemberId){
		return partyMemberService.selectById(partyMemberId);
	}
	
	/**
	 * 删除数据
	 * @param partyMemberId
	 * @return
	 */
	@RequestMapping("deleteMember")
	@SystemControllerLog(description = "删除党员数据")
	@ResponseBody
	public Map<String, Object> deleteMember(String partyMemberId){
		return partyMemberService.deleteMember(partyMemberId);
	}

}
